package tt;
public class t3 {
    public static void main(String[] args) {
        int t = 0;
        for (int n = 2;n <= 20000; n++) {
            if (f(n)) {
                if (t++ % 5 == 0) {
                    System.out.println();
                }
                System.out.print(n + " ");
            }
        }
    }
    public static boolean f(int n) {
        if (n < 2) {
            return false;
        }
        for (int i = 2; i <= Math.sqrt(n); i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}